package com.huilian.iotbox.admin.wap.controller;

import com.huilian.iotbox.admin.wap.service.ProductService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.ProductDto;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author xilin
 * @date 2023/3/7 18:15
 */
@RestController
@RequestMapping("/api/product")
public class ProductController extends UserInfoController {
    @Autowired
    private ProductService productService;

    @GetMapping("/findDeviceGroupByProductId")
    public ServerResponse findDeviceGroupByProductId(ProductDto productDto, HttpServletRequest request) {
        UserInfo userInfo = super.getLoginUserInfo(request);
        productDto.setUserInfo(userInfo);
        return productService.findDeviceGroupByProductId(productDto);
    }

}
